import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;


public class KillJar {
	
	public static void main(String[] args) {
		 Runtime run = Runtime.getRuntime();
	        try {
	            Process process = run.exec(new String[] {"/bin/sh", "-c", "kill$(ps -aux | grep meeting-0.0.1-SNAPSHOT | grep -v grep | awk '{print $2}')"});
	            InputStream in = process.getInputStream();
	            BufferedReader bs = new BufferedReader(new InputStreamReader(in));
	            List<String> list = new ArrayList<String>();
	            String result = null;
	            while ((result = bs.readLine()) != null) {
	                System.out.println("job result [" + result + "]");
	                list.add(result);
	            }
	            in.close();
	            process.destroy();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	}

}
